package com.you.atlas.web.member.module.screen;

import org.springframework.beans.factory.annotation.Autowired;

import com.alibaba.citrus.turbine.Context;
import com.alibaba.citrus.turbine.Navigator;
import com.you.common.webx.AuthContext;
import com.you.member.biz.service.MemberQueryService;
import com.you.member.dal.dao.dataobject.MemberDO;

public class SetPassword {

    @Autowired
    private MemberQueryService memberQueryService;

    public void execute(Context context, Navigator navigator) {
        Long memberId = AuthContext.getContext().getMemberId();
        MemberDO memberDO = memberQueryService.find(memberId);
        if (memberDO.getEmail() != null) {
            navigator.redirectTo("memberModule").withTarget("me.vm");
            return;
        }
        context.put("memberDO", memberDO);
    }
}
